<?php

declare (strict_types=1);
/**
 * @copyright 深圳市易果网络科技有限公司
 * @version 1.0.0
 * @link https://dayiguo.com
 */

namespace App\Controller\agent;

use App\Kernel\Util\AgentJwtInstance;
use App\Middleware\User\AgentMiddleware;
use App\Service\Agent\ProfitService;
use Hyperf\Guzzle\ClientFactory;

use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\AutoController;
use Hyperf\Snowflake\IdGeneratorInterface;
use Hyperf\HttpServer\Annotation\Middleware;

/**
 * 收益管理
 *
 * @AutoController()
 * @Middleware(AgentMiddleware::class)
 * @author 张昊(2396675557@qq.com)
 * @package App\Controller\admin
 */
class ProfitController extends Controller
{

    /**
     * @Inject
     * @var ProfitService
     */
    public $profit_service;

    /**
     * 收益列表
     */
    public function listTop()
    {
        $result = $this->profit_service->listTop();

        $this->success( $result );
    }

    /**
     * 单条商家流水详情
     */
    public function getStoreProfitById()
    {
        $store_id = (int)$this->request->input('store_id', 0);

        $result = $this->profit_service->getStoreProfitById($store_id);

        $this->success($result);
    }

    /**
     * 商家流水 - 昨天
     */
    public function businessProfit()
    {
        $result = $this->profit_service->businessProfit();

        $this->success($result);
    }

    /**
     * 渠道商流水 - 昨天
     */
    public function channelProfit()
    {
        $result = $this->profit_service->channelProfit();

        $this->success($result);
    }

    /**
     * 商家流水 - 全部
     */
    public function businessProfitList()
    {
        $result = $this->profit_service->businessProfitList();

        $this->success($result);
    }

    /**
     * 渠道商流水 - 全部
     */
    public function channelProfitList()
    {
        $result = $this->profit_service->channelProfitList();

        $this->success($result);
    }

    /**
     * 分公司收益
     */
    public function companyProfitTop()
    {
        $result = $this->profit_service->companyProfitTop();

        $this->success( $result );
    }

    /**
     * 昨日分公司市代返佣
     */
    public function yesterdayCityProfit()
    {
        $result = $this->profit_service->yesterdayCityProfit();

        $this->success($result);
    }

    /**
     * 昨日分公司区代返佣
     */
    public function yesterdayAreaProfit()
    {
        $result = $this->profit_service->yesterdayAreaProfit();

        $this->success($result);
    }

    /**
     * 昨日分公司渠道商返佣
     */
    public function yesterdayChannelProfit()
    {
        $result = $this->profit_service->yesterdayChannelProfit();

        $this->success($result);
    }

    /**
     * 昨日分公司合伙人市代返佣
     */
    public function yesterdayPartnerCityProfit()
    {
        $result = $this->profit_service->yesterdayPartnerCityProfit();

        $this->success($result);
    }

    /**
     * 昨日分公司合伙人区代返佣
     */
    public function yesterdayPartnerAreaProfit()
    {
        $result = $this->profit_service->yesterdayPartnerAreaProfit();

        $this->success($result);
    }

    /**
     * 昨日分公司合伙人渠道商返佣
     */
    public function yesterdayPartnerChannelProfit()
    {
        $result = $this->profit_service->yesterdayPartnerChannelProfit();

        $this->success($result);
    }

    /**
     * 分公司直招市代流水列表
     */
    public function getOfficeCityList()
    {
        $result = $this->profit_service->getOfficeCityList();

        $this->success($result);
    }

    /**
     * 分公司直招区代流水列表
     */
    public function getOfficeAreaList()
    {
        $result = $this->profit_service->getOfficeAreaList();

        $this->success($result);
    }

    /**
     * 分公司直招渠道商流水列表
     */
    public function getOfficeChannelList()
    {
        $result = $this->profit_service->getOfficeChannelList();

        $this->success($result);
    }

    /**
     * 分公司直招合伙人区代流水
     */
    public function getOfficePartnerArea()
    {
        $result = $this->profit_service->getOfficePartnerArea();

        $this->success( $result );
    }

    /**
     * 分公司直招合伙人市代流水
     */
    public function getOfficePartnerCity()
    {
        $result = $this->profit_service->getOfficePartnerCity();

        $this->success( $result );
    }

    /**
     * 分公司直招合伙人渠道商流水
     */
    public function getOfficePartnerChannel()
    {
        $result = $this->profit_service->getOfficePartnerChannel();

        $this->success( $result );
    }

    /**
     * 合伙人收益
     */
    public function partnerProfitTop()
    {
        $result = $this->profit_service->partnerProfitTop();

        $this->success( $result );
    }
}